<template>
  <div>
    <div class="banner" @click="handleToGallary">
      <img class="banner-img" :src="bannerImg"/>
      <div class="banner-info">
        <div class="banner-tittle">
          {{sightName}}
        </div>
        <div class="banner-number">
          <font-awesome-icon :icon="['far', 'circle']"></font-awesome-icon>
          1
        </div>
      </div>
    </div>
    <common-gallary
      :img="gallaryImgs"
      v-show="gallaryShow"
      @close="handleCloseGallary"
    ></common-gallary>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'

export default {
  name: 'Header',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data() {
    return {
      gallaryShow: false
    }
  },
  methods: {
    handleToGallary() {
      this.gallaryShow = true
    },
    handleCloseGallary() {
      this.gallaryShow = false
    }
  },
  components: {
    CommonGallary
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    overflow: hidden
    height: 0
    padding-bottom: 4rem

    .banner-img
      width: 100%
      height 4rem

    .banner-info
      display: flex
      position: absolute
      left: 0
      right: 0
      bottom: 0
      line-height: .6rem
      color: #fff
      background-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))

      .banner-tittle
        flex: 1
        font-size: .32rem
        padding: 0 .2rem

      .banner-number
        height: .32rem
        line-height: .32rem
        margin-top: .14rem
        padding: 0 .4rem
        border-radius: .2rem
        background: rgba(0, 0, 0, .8)
        font-size: .24rem

        .banner-icon
          font-size: .24rem
</style>
